home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / cnews004.zip / CNEWS004.NWS next >
Text File  |  1988-02-21  |  60KB  |  1,484 lines

  1.      Volume 1, Number  4                             21 February  1988
  2.      +---------------------------------------------------------------+
  3.      |                                                               |
  4.      |                       -  C   News  -                          |
  5.      |                                                               |
  6.      |                        International                          |
  7.      |                C Programming & Compiler Review                |
  8.      |                         Newsletter                            |
  9.      |                                                               |
  10.      +---------------------------------------------------------------+
  11.      US Office:
  12.      Editor at large                                       Barry Lynch
  13.      Assistant Editor                                      Ami Dworkin
  14.      Technical Editor                                Marshall Presnell
  15.  
  16.      Australian Office:     
  17.      Editor                                               David Nugent
  18.  
  19.      C News  is  published  bi-weekly by  the  C BBS as its official
  20.      newsletter.  You are encouraged to submit articles for publication
  21.      in C News.  Articles should be related to C programming and can be
  22.      Tutorials, reviews or articles of interest to the C programming
  23.      community.  All Operating systems are fairly represented and this
  24.      newsletter shows no favoritism to any one in particular.  Instruct-
  25.      ions on how to submit articles for publication is included on the
  26.      last page. 
  27.           
  28.      C News is the property of the C BBS and is Copyright 1988 by the
  29.      the C BBS.  All rights are reserved and distribution is limited to
  30.      electronic distribution and personal printed copies.  C News cannot
  31.      be resold at any profit, by any organization.  All material enclosed
  32.      within the newsletter is the opinions of the writers and not the
  33.      C BBS or it's Sysop. 
  34.  
  35.      DISTRIBUTION POINTS:
  36.  
  37.  
  38.      EASTERN US - C BBS 109/713   (703)998-8377
  39.      
  40.      CANADA     - Another BBS 
  41.      AUSTRALIA  - Alpha Centuri BBS
  42.      EUROPE     - 150/1 - Sysop: Henk Wevers
  43.  
  44.      New distribution points are always welcome, if you are interested
  45.      send me a netmail message at the above address.
  46.  
  47.      
  48.      C News 1-04                                          21 Feb 1988
  49.  
  50.      =================================================================
  51.                              TABLE OF CONTENTS
  52.      =================================================================
  53.      
  54.  
  55.      1. EDITORIAL 
  56.              The Heap: messages from the editor....................  1
  57.              New Column, User requests
  58.  
  59.      2. PATCHES/MITE REPORTS
  60.         MSC Version 5.0 Bug Listings  .............................  2
  61.  
  62.      3. SHORT SNIPS  
  63.         Magazine Review's
  64.             by Barry Lynch   ......................................  6
  65.  
  66.      4. BOOK REVIEWS
  67.         MS-DOS Developer's Guide   ................................  7
  68.             by Barry Lynch
  69.         
  70.      5. SOFTWARE REVIEWS
  71.         Public Domain:   ..........................................  8
  72.         SETPRGMS.ARC, SHIFT_C.ARC, SYSACT11.ARC, XENIXARC.ARC,
  73.         CDATE.ARC, C_DATES.ARC, C-SUBR.ARC, JCL-SRC.ARC, and
  74.         NDMAKE41.ARC
  75.            by David Nugent
  76.  
  77.      6. FEATURE ARTICLE
  78.         Filename Wildcard Expansion in Microsoft C  ............... 15
  79.  
  80.      7. /Usr/Bin
  81.            by Marshall Presnell   ................................. 26
  82.  
  83.      8. NOTES
  84.         Article Submission Standards  ............................. 28
  85.         Address's   ............................................... 29
  86.         USER Response Form  ....................................... 30
  87.     
  88.      9. INDEX   ................................................... 31
  89.  
  90.  
  91.  
  92.      C News 1-04                 Page 1                   21 Feb 1988
  93.  
  94.      =================================================================
  95.                                  EDITORIAL
  96.      =================================================================
  97.  
  98.      The HEAP: Messages from the Editor.
  99.  
  100.  
  101.           With this issue of C News we start a new column, and begin
  102.      <hopefully> a new tradition.  First, Marshall Presnell joins us
  103.      with his column the "/usr/bin".  Dedicated to technical questions
  104.      and answers relating to C programming.  Marshall has a BS in
  105.      Electrical Engineering and is quite a accomplished programmer in
  106.      C and ASM.  Marshall's column will be a regular feature, and I 
  107.      know that he will provide a valuable service to all of us in the
  108.      future.
  109.  
  110.           The next feature of C News that I am proud of, and hope becomes
  111.      a regular feature.  Is an article by Bill Mayne on Expanding
  112.      arguments from the command line and some other goodies.  Mr. Mayne
  113.      has done an excellent job and should be congratulated by all.  It
  114.      is hoped that articles like his will be forthcoming in future issues
  115.      of C News as well.
  116.  
  117.           Last Issue, I included a user response form for users to fill
  118.      and send back if they had the chance.  Well, quite a few users did
  119.      and I thank you for the support.  Most of the suggestions dealt
  120.      with more beginner oriented tutorials and a technical question
  121.      and answer column.  Both of these requests have been satisfied
  122.      in this issue, and we will attempt to keep up the quality of work
  123.      that we have been able to produce for this issue in future issues.
  124.  
  125.      
  126.       B C'ng U
  127.  
  128.       Barry Lynch
  129.  
  130.  
  131.                          
  132.           C News 1-04                 Page 2                   21 Feb 1988
  133.  
  134.      =================================================================
  135.                           PATCHES/MITE REPORTS
  136.      =================================================================
  137.  
  138.      MSC Version 5.0
  139.  
  140.   Be VERY careful when using the MSC5 compiler. The optimizer is
  141. generating a LOT of bad code in places. In some cases you can disable
  142. enough of the optimizer to force it to generate good code, but in
  143. other cases one must simply rewrite code to trick the compiler into
  144. doing the write thing. The problems appear to be with large memory
  145. models. All C code was compiler with "Alfu" memory model.
  146.  
  147.     In the next two messages I will show two code samples that
  148. generated bad code. The samples are simplified extracts that
  149. demonstrate a compiler bug..
  150.  
  151.    This demonstrates a bug in the loop optimizer. The cast to a CHAR *
  152. is what confused the optimizer... The code is large memory model
  153. compiled with "Alfu". The bug is correctable by disabling the loop
  154. optimizer.
  155.  
  156. #include<stdio.h>
  157.  
  158.  
  159. #define GETSEGPTR(xseg,xoff) ((char *) (((long) xseg <<16) | xoff))
  160. #define WHATEVER 20
  161.  
  162. void
  163. fortran
  164. badcode(buffer,unpointer)
  165. char *buffer;
  166. unsigned *unpointer;
  167. {
  168.         char *ptr;
  169.         unsigned segval, get_a_segval();
  170.         int i;
  171.  
  172.         segval=get_a_segval();
  173.  
  174.         for(i=0; i< WHATEVER ; i++)
  175.         {
  176.            do_something( GETSEGPTR(segval,0));
  177.            segval+=16;
  178.         }
  179. }
  180.  
  181.  
  182.     It does not matter what the called routines do, The compiler does
  183. not generate the code to add 16 (seg size) to the variable SEGVAL..
  184. Below is the asm that the compiler generates....
  185.  
  186. C News 1-04                 Page 3                   21 Feb 1988
  187.  
  188. =================================================================
  189.                       PATCHES/MITE REPORTS
  190. =================================================================
  191.  
  192. MSC Version 5.0
  193.  
  194. *** 000024      be 14 00        mov     si,20
  195. *** 000027      81 46 fe 40 01  add     WORD PTR [bp-2],320    
  196. ;segval
  197.                                         $L20000:
  198.         ;|***         {
  199.         ; Line 20
  200.         ;|***            do_something(GETSEGPTR(segval,0));
  201.         ; Line 21
  202. *** 00002c      ff 76 f6        push    WORD PTR [bp-10]
  203. *** 00002f      ff 76 f4        push    WORD PTR [bp-12]
  204. *** 000032      9a 00  call    FAR PTR _do_something
  205. *** 000037      83 c4 04        add     sp,4
  206.         ;|***            segval+=16;
  207.         ;|***         }
  208.         ; Line 23
  209. *** 00003a      4e              dec     si
  210. *** 00003b      75 ef           jne     $L20000
  211.         ;|*** }
  212.  
  213.  
  214.  
  215.    In this above loop, segval is never changes at all... Nice huh?
  216.  
  217.   The code sample below is even more terrifying since the compiler is
  218. not generating badly optimized code so much as it is just generating
  219. BAD code. Below is a sample of a C routine that the compiler will kill
  220. you on. This code was compiled with "Alfu". The only way to correct
  221. the compiler was to disable intrinsics, any other optimizer flag made
  222. no difference.
  223.  
  224.  
  225. #include<stdio.h>
  226.  
  227.  
  228. void
  229. fortran
  230. badcode(buffer,unpointer)
  231. char *buffer;
  232. unsigned *unpointer;
  233. {
  234.         char *ptr, *getaptr();
  235.  
  236.  
  237.         ptr=getaptr();
  238.  
  239.  
  240. C News 1-04                 Page 4                   21 Feb 1988
  241.  
  242. =================================================================
  243.                       PATCHES/MITE REPORTS
  244. =================================================================
  245.  
  246. MSC Version 5.0
  247.  
  248.  
  249.         *unpointer = strlen(ptr);
  250. }
  251.  
  252.  
  253.    The assignment of strlen() to *numpointer will generate bad code.
  254. It does not really matter if numptr is an unsigned int or an int by
  255. the way. Below is the asm that the compiler will generate...
  256.  
  257.         ;|***
  258.         ;|***         *unpointer = strlen(ptr);
  259.         ; Line 13
  260. *** 000018      c4 5e 06    les bx,DWORD PTR [bp+6]     ;unpointer
  261. *** 00001b      c4 7e fc    les di,DWORD PTR [bp-4]     ;ptr
  262. *** 00001e      b9 ff    mov cx,-1
  263. *** 000021      33 c0       xor ax,ax
  264. *** 000023      f2          repnz
  265. *** 000024      ae          scasb
  266. *** 000025      f7 d1       not cx
  267. *** 000027      49          dec cx
  268. *** 000028      26 89 0f    mov WORD PTR es:[bx],cx
  269.         ;|*** }
  270.  
  271.  
  272.    In the asm above, you will note that it generates an LES twice in a
  273. row. The value loaded into ES by the first LES is clobbered by the
  274. second LES. The last instruction to load CX into ES:[BX] is invalid
  275. since ES does not NECESSARILY point to the correct data segment. If
  276. the segment value of the pointer happens to be equal to SS, the code
  277. will work, but the compiler should not assume this, especially since
  278. the code was generated with "Alfu" - which means among other things,
  279. ES!=DS....  
  280.  
  281.     No combination of optimizer switches could get the compiler to
  282. generate the right code for this. The routine had to be modified
  283. to load the strlen() value into an intermediate location, and from
  284. there into the final target.
  285.  
  286.      Under OS/2 bugs like this make themselves know fairly quickly,
  287. A bad segment value is trapped instantly by the kernel. Such Bugs are
  288. are much more difficult to locate under MS-DOS. The above bugs in the
  289. MSC 5.0 compiler can be reproduced in the OS/2 SDK compiler
  290. as well.............
  291.  
  292.     The 5.0 compiler is nice, and some of the new features are very
  293. handy. When the optimizer works, it generates wonderful code, but
  294. C News 1-05                 Page 5                   21 Feb 1988
  295.  
  296. =================================================================
  297.                      PATCHES/MITE REPORTS
  298. =================================================================
  299.  
  300. MSC Version 5.0
  301.  
  302. when its bad - its VERY bad. It appears as though MSC5.0 was rushed
  303. to market before it was completely debugged.
  304.  
  305. Daniel Doman
  306.  
  307. *** Editors Note:  An arc file is included with this newsletter.
  308.  
  309.      C News 1-04                 Page 6                   21 Feb 1988
  310.      
  311.      ================================================================
  312.      SHORT SNIPS -      MAGAZINE REVIEWS  by Barry Lynch
  313.      ================================================================
  314.   
  315.      Magazine: The C Users Journal
  316.      Publisher: R&D Publications
  317.      Published: 8 times a year.
  318.      Subject Matter: C 
  319.  
  320.      Issue: Vol 6 No 2 - February 88.
  321.  
  322.      The C Users Journal is the result of a merger between the C Users
  323.      Group Newsletter and The C Journal.  This is the first time that
  324.      I have had a chance to review - C Users Journal, and here are my
  325.      impressions.
  326.  
  327.      The subject covered by the articles included:  Revision Control
  328.      Systems, An article on Compiler rounding of floating numbers, 
  329.      Standard (ANSI) C,  as well as an article on Null Pointer Errors
  330.      in MSC.  (I for one, needed this article to answer a few pointing
  331.      questions.)  
  332.  
  333.      Overall, the magazine covered quite alot of territory for one issue.
  334.      At US $3.95 I found it to be a bargain, this compared to the amount
  335.      of C issues covered in Computer Language as reviewed in Issue 3 of
  336.      C News.  I hope that the magazine's staff will continue to produce 
  337.      the same amount of coverage that they did in this issue.  I have a
  338.      real problem with magazines that get carried away with the gloss, and
  339.      advertising, and forget the reason for being to begin with.
  340.  
  341.      The C Users Journal is recommended as a supplement to every C
  342.      programmer's monthly reading regime, as long as it produces quality
  343.      issues such as this one.
  344.  
  345.  
  346.           
  347.      C News 1-04                 Page 7                   21 Feb 1988
  348.      
  349.      ================================================================
  350.                              BOOK REVIEWS                     
  351.      ================================================================
  352.  
  353.      ________________________________________________________________
  354.  
  355.      MS DOS Developer's Guide 
  356.      Author : John Angermeyer & Kevin Jaeger
  357.      Publisher : Howard W. Sams & Company. Indianapolis. 1987. 
  358.      Cost : $24.95 (US$)  
  359.  
  360.  
  361.      This book is aimed at serious software developer's on the IBM PC
  362. and related clones.  Topics covered include: 1) Program and Memory
  363. Management in MS-DOS, 2) Real-Time Programming Under MS-DOS, 3)
  364. Installable Device Drivers, 4) LANS and MS-DOS  and much more.  
  365.  
  366.      As with all books that I have purchased from this publisher, I was
  367. not disappointed.  The authors have taken the time to write a clear and
  368. concise book on very technical subject matter.  Prior exposure to the
  369. architecture of the IBM PC is recommended, as the authors assume a
  370. basic working knowledge of how a PC operates.  In regards to memory
  371. management, and CPU management.  Most of the code listed in the book is
  372. in Assembler, so a little prior knowledge there would be of benefit.
  373.  
  374.      Overall, I enjoyed the book, and consider one of my better buys in
  375. the PC software/reference book arena.
  376.  
  377. Barry Lynch - Alexandria, VA
  378.      C News 1-04                 Page 8                   21 Feb 1988
  379.      
  380.      ================================================================
  381.      PUBLIC DOMAIN SOFTWARE REVIEWS:
  382.      ================================================================
  383.  
  384.      *** Editor's Note:  This section is brought to us by the users
  385.          of the Alpha Centuri BBS in Melbourne, Australia.
  386.          
  387.          << Thanks, David >>
  388.      ________________________________________________________________
  389.  
  390. Filename:  SETPRGMS.ARC
  391.  
  392. Finding  this  file was quite a surprise; and  its  contents  are 
  393. both instructive and useful - even to the veteran programmer.
  394.  
  395. These  programs  are  specific to MS-DOS.   SET  PRGMS  refer  to 
  396. programs which manipulate the environment from within a  program.  
  397. No - not the program's environment, but THE environment: the  one 
  398. maintained by COMMAND.COM.
  399.  
  400. The  theory on how to do this has been known for some time.   But 
  401. this  is  the first set of programs I have found  which  actually 
  402. make use of the technique.
  403.  
  404. When  a  program  is loaded, any references  to  the  environment 
  405. usually  refer  to  the environment of  THAT  program,  which  is 
  406. initially only a copy of it's parent's (usually).  These programs 
  407. implement   the  technique  of  chaining  back  to   the   master 
  408. environment and altering that, so that when you drop back to  DOS 
  409. the environment remains changed.
  410.  
  411. The  usefulness  of this ability is best shown by   the  examples 
  412. presented in the ARC.  These include: the ability to assign to an 
  413. environment variable the path name of the current directory, read 
  414. a  line  from the console into a variable, and sets  for  current 
  415. date  and time variables.  Great stuff for fancy batches, and  an 
  416. excellent teacher of the technique.
  417.  
  418. The file also comes with a system logging utility implemented  in 
  419. quite a practical fashion via batch files.
  420.  
  421. Source included:  Complete ASM source, including .COM executables 
  422. and program documentation.  Very well commented and quite  robust 
  423. code.
  424.  
  425. Assembler:   Very little use is made of assembler macros,  and  no 
  426. special  include  files  are  assumed.  From  what  I  can  tell, 
  427. anything  from way back v1.0 of IBM's ASM.EXE would do.   I  dare 
  428. say  that  Eric  Issacson's  blindingly  fast  PD  A86   assembler 
  429. (available on this board) would make short work of it.
  430. C News 1-04                 Page 9                   21 Feb 1988
  431.      
  432. ================================================================
  433. PUBLIC DOMAIN SOFTWARE REVIEWS:
  434. ================================================================
  435.  
  436. ________________________________________________________________
  437.  
  438. Filename:  SHIFT_C.ARC
  439.  
  440. Shift  is a handy routine to add to your super-quick  screen  I/O 
  441. library.  It is an ASM routine which may be used to shift a  line 
  442. of text on the video screen one column left or right.
  443.  
  444. Source included: Yes
  445.  
  446. Assembler:  Originally compiled under MASM 5.0, but I can't  find 
  447. too much in it that earlier versions would dislike.  Assembles ok 
  448. under MASM 4.0 (for example).
  449.  
  450. Compiler:  This is a C subroutine.  Calling conventions  are  for 
  451. MSC or Turbo C (preceding underline), but you can call  _shift() 
  452. from other compilers.
  453.  
  454. Notes:  This routine is VERY hardware specific, and only  applies 
  455. to a machine which is 100% IBM compatible.  On the other hand, it 
  456. would  be easily adapted to other environments, if you  knew  the 
  457. various machine specific addresses.
  458. _________________________________________________________________
  459.  
  460. Filename: SYSACT11.ARC
  461.  
  462. This little nugget contains a utility to log "execute" DOS  calls 
  463. to a log file, with start and execution timings and the number of 
  464. read/write and other DOS calls made by the program.
  465.  
  466. If you are familiar with Xenix or Unix, this should ring a  bell.  
  467. Something  like acctcom available there.  This program takes  the 
  468. form  of a mighty small .ASM TSR used for intercepting DOS  calls 
  469. loaded  on boot up, together with two programs and a  batch  file 
  470. used to produce reports and summaries.
  471.  
  472. Its  these last two programs that make the .ARC  so  interesting.  
  473. The  reports  can summarize activity in a number  of  interesting 
  474. ways, and can merge the file to produce excellent summaries.
  475.  
  476. After  all,  who out there who uses a hard  drive  (floppies  not 
  477. supported)  can  tell you which program is used the  most  often, 
  478. makes  the most disk & device I/O calls or takes the  longest  to 
  479. execute.   A  very interesting statistic which  can  change  your 
  480. habits remarkably for the better.
  481.  
  482. This  is not a simple activity logger.  Its a work analysis  tool 
  483. useful  to  professionals and serious hobbyists.  It  comes  with 
  484. C News 1-04                 Page 10                  21 Feb 1988
  485.      
  486. ================================================================
  487. PUBLIC DOMAIN SOFTWARE REVIEWS:
  488. ================================================================
  489.  
  490. full  source (.ASM and .PAS), so it can teach a good  deal  about 
  491. intercepting the DOS interrupt.
  492.  
  493. Source included: Yes
  494.  
  495. Language: Turbo Pascal, Assembler.
  496.  
  497. Compiler/Assembler:   Not  specifically  stated,   but   probably 
  498. requires TP 3.0 or above.  Version of MASM or other assembler  is 
  499. not critical.
  500. _________________________________________________________________
  501.  
  502. Filename: XENIXARC.ARC
  503.  
  504. This is SEA's original ARC utility ported to SCO Xenix.  Its  the 
  505. first  time  I've seen a successful port, and I've tried  a  few!  
  506. Other   Unix   ports  have  memory/model  problems   and   slight 
  507. incompatibilities when compiled under Xenix.
  508.  
  509. The  beauty  of this program is that it is  100%  PC  compatible. 
  510. It can read PC ARCs and the ARCs it creates can be ported to DOS.
  511. It   does  not,  of  coarse,  do  the   newline/carriage   return 
  512. translation!   One minor differences is that file names ARE  case 
  513. sensitive, like Xenix.  Causes no problems when swapping with DOS 
  514. though.
  515.  
  516. Wildcards  "*"  and "?" are fully supported in the  same  way  as 
  517. under  DOS.   However,  because  most  Xenix/Unix  shells  expand 
  518. wildcards before a program sees them, you must quote them  (using 
  519. quotes) to prevent this when EXTRACTING files.  When updating  or 
  520. adding  files though, you can have your choice as to who  expands
  521. the wildcards.
  522.  
  523. Source Included:  Yes - no executables.
  524.  
  525. Language:  C, SCO/IBM Implementation (MicroSoft Xenix compiler)
  526.  
  527. Version:  Minimum compiler version is the 2.1 (IBM 2.0)
  528. C News 1-04                 Page 11                  21 Feb 1988
  529.      
  530. ================================================================
  531. PUBLIC DOMAIN SOFTWARE REVIEWS:
  532. ================================================================
  533.  
  534. Filename: CDATE.ARC
  535.  
  536. This  is  a  handy utility for batch files which  is  capable  of 
  537. testing the current system time and date, returning a "truth"  to 
  538. the  caller via DOS errorlevel.  The flexibility of this  program
  539. and the parsing technique used for examining the command line are 
  540. instructive.
  541.  
  542. As a utility, CDATE can be quite invaluable; especially those  of
  543. use  running bulletin boards.  The current day of the month,  day
  544. of the week, month of the year or any combination of these can be 
  545. tested  and  acted upon.  The program is quite  "intelligent"  in 
  546. examining  the  command line and understands a  range  of  common 
  547. abbreviations.
  548.  
  549. Source: Yes.
  550. Language: C
  551. Compiler: Turbo C, but a trivial port to other MS-DOS compilers.
  552. __________________________________________________________________
  553.  
  554. Filename: C_DATES.ARC
  555.  
  556. At  last  a  group of routines which  handles  dates!   This  ARC 
  557. contains  a number of routines used for converting dates  to  and 
  558. from  "long",  allowing dates to be manipulated and  operated  on 
  559. mathematically.
  560.  
  561. These  routines view a date as one day in a continuing series  of 
  562. days,  converting  day, month a year to long integer  and  back.  
  563. This is invaluable for business applications.
  564.  
  565. Both 'long' (4 digit year) and 'short' date format are implicitly 
  566. supported.
  567.  
  568. Source: Yes.
  569. Language: C
  570. Compiler: Quite portable, K & R standard.
  571. Notes:  Two  demonstration  programs  also  provided,   including 
  572. source.
  573. C News 1-04                 Page 12                  21 Feb 1988
  574.      
  575. ================================================================
  576. PUBLIC DOMAIN SOFTWARE REVIEWS:
  577. ================================================================
  578.  
  579. Filename: C-SUBR.ARC
  580.  
  581. This file contains a variety of handy routines for a beginner  or 
  582. intermediate  C programmer.  It includes all the common  practice 
  583. algorithms  and  is well coded to provide both a  high  degree  of 
  584. readability (and understandability) and efficiency.  These are  a 
  585. good learning tool.
  586.  
  587. For  the more experienced programmers, it may also save  time  in 
  588. providing a library of reliable, short routines which are  easily 
  589. incorporated into a project, even at the object (link) level.
  590.  
  591. Many   common  requirements  of  C  programmers  are  met,   from 
  592. displaying  error messages, parsing a line for  information,  de-  and
  593.  
  594. en-tabbing text, right/left text justification to block  CRC  checking
  595. and copying files.
  596.  
  597. Source:  Yes
  598.  
  599. Language: C
  600.  
  601. Compiler: Written for Turbo C, but easily ported.  Some  routines 
  602. include  inline assembler not supported by some  compilers.   (If  you
  603. are using MSC, see the entry in this area for CASM.ARC). 
  604. _____________________________________________________________________
  605.  
  606. Filename: JCL-SRC.ARC
  607.  
  608. This  program  represents the source code for an  extended  batch 
  609. command language provided for operation with MS-DOS called "JCL", 
  610. written (and uploaded) by Ian Rutherford.
  611.  
  612. JCL  in  its  executable form has been available  in  the  public 
  613. domain  for  some  time.  It allows special  "JCL"  files  to  be 
  614. executed providing a great deal more flexibility and control  for 
  615. batch  files,  including support for variables  and  full  screen 
  616. control.
  617.  
  618. The program is very instructive in a number of areas,  especially  to 
  619. intermediate C programmers: those familiar with  the  language 
  620. looking
  621. to do something useful with it.
  622. Source: Yes - no executables.
  623. Language: C
  624.  
  625. Compiler: Turbo C, but can be ported to most MS-DOS compilers. Notes:
  626. Executables may be found in the DOS utilities file  area,  called 
  627. C News 1-04                 Page 13                  21 Feb 1988
  628.      
  629. ================================================================
  630. PUBLIC DOMAIN SOFTWARE REVIEWS:
  631. ================================================================
  632.  
  633. JCL.ARC.   Another version may be found  in  the  286/386  area, 
  634. compiled  to  use the extended instruction  set  of  those 
  635. microprocessors.
  636. ________________________________________________________________
  637.  
  638. Filename: NDMAKE41.ARC
  639.  
  640. For  any  programming  project, the  classic,  Unix-style  'make' 
  641. utility is an absolute *must*.  This little program I have been
  642. looking for some time.   Ever since I first hacked into the source
  643. code for Binkley Term to see  all of Opus' file transfer secrets.  Bob
  644. Hartman, the author  of  Binkley (and many other Fido/Opus utilities,
  645. AND part of the Opus  development  team,  and  one  of the  developers 
  646. of  the  FOSSIL  communications drivers, and ... [need I say more?]) 
  647. recommended  it  in  his program documentation, due to  some  of  its 
  648. unique  abilities.
  649.  
  650. I was eager to unARC it once I had it on the system.  I have used  a 
  651. number  of  MAKE utilities; one received  with  MicroSoft's  C 
  652. compiler  (average to useless), POLYTRON's PMAKE (very  powerful, 
  653. allows   multiple  directories  for  development  but  has   some 
  654. incompatible but very powerful extensions) and a number of public 
  655. domain  implementations.  I certainly wasn't  disappointed.   It  had
  656. more facilities than I had bargained for, and all using  make  syntax
  657. compatible with Unix make.
  658.  
  659. Before  discussing  the features of this make, I  should  mention 
  660. what  a  MAKE program does.  MAKEs are used for medium  to  large 
  661. scale  program development; particularly in  modular  programming 
  662. languages  such  as  C, Pascal, Fortran  and  Assembler.   It  is 
  663. historically  attached  to  C (under Unix), but  can  be  easily 
  664. adapted to basically any modular programming language.  It  takes
  665. the place  of multiple batch files and compiles,  assembles  and 
  666. links modules  only  if  they  are  'out  of  date'.    Complete
  667. applications  can  be assembled simply by  entering  the  command 
  668. 'make'. If this has you interested, then download it and read the 
  669. docs.
  670.  
  671. NDMAKE  version 4.1 is the most powerful I have ever  seen.   Its 
  672. major  feature is the ability to create a LINK and  LIB  response 
  673. file whenever the command line would exceed DOS's 128 byte limit. If 
  674. that's  not  enough,  it also has  the  ability  to  maintain 
  675. multiple versions of the same application from one set of  source 
  676. files  (via environment variables), use environment variables  as 
  677. macros  (an absolute MUST for ANY make, in my books), and have  a 
  678. single  file  called MAKE.INI for definition of  MAKE's  built-in 
  679. rules  which may exist in your current directory or  anywhere  in 
  680. C News 1-04                 Page 14                  21 Feb 1988
  681.      
  682. ================================================================
  683. PUBLIC DOMAIN SOFTWARE REVIEWS:
  684. ================================================================
  685.  
  686. your executable search path.
  687.  
  688. If  you're  after a MAKE utility that has all the edge,  look  no 
  689. further.  It comes in executable form only, but is well worth the 
  690. effort of downloading.
  691.  
  692. Source code: No
  693.  
  694. Notes: Generic application to all compiler/assembler based modular 
  695. programming  languages.   Especially useful for medium  to  large 
  696. project development.  Comes with  excellent documentation  (50K), and 
  697. has excellent  background information  for  first time  make users. C News 1-04                 Page 15                  21 Feb 1988
  698.      
  699. ================================================================
  700. Title: Filename Wildcard Expansion in Microsoft C
  701. ================================================================
  702.  
  703. Audience: Beginning to intermediate programmers using Microsoft C.
  704.           Some methods are also applicable to other versions of C.
  705.  
  706. Topics:   (1) Use of SETARGV.OBJ to expand command line arguments.
  707.           (2) Use of DOS calls (with "intdos()" and "intdosx()") to
  708.               expand wildcards from within programs. Covers use of
  709.               disk transfer area (DTA) and DOS functions 4E and 4F.
  710.           (3) Source code for demonstration programs and C functions  
  711.             to perform the DOS calls.
  712.           (4) Use of recursion to traverse directories.
  713.  
  714.                Filename Wildcard Expansion in Microsoft C
  715.  
  716. The power of many DOS commands is enhanced by the wildcard expansion
  717. feature, enabling you to specify a group of files by including the
  718. wildcard characters '*' (match anything) and '?' (match any character)
  719. in the filename or extent part of a path.  For example, "DIR
  720. C:\INCLUDE\*.H" shows you a list of all C header files in the
  721. directory "C:\INCLUDE'.  "ERASE *.BAK" erases all files in the current
  722. directory which have the extension "BAK".  "COPY SUB\PROG1.*" copies
  723. all files with a filename of "PROG1" (and any extent, or none) from
  724. the subdirectory "SUB" to the current directory.  Including this very
  725. useful feature into your own C programs is easier than you might
  726. think.
  727.  
  728. This article will first show how to expand wildcards in the command
  729. line by means of an object (.OBJ) file provided by Microsoft C. Then
  730. it will demonstrate a more powerful technique of doing your own
  731. wildcard expansion inside a program, using a few simple DOS calls by
  732. means of the "intdos()" and intdosx()" functions.  The latter
  733. technique is portable to any implementation of C under MS/DOS or
  734. PC/DOS providing functions for issuing DOS calls.  Each technique will
  735. be demonstrated by simple programs which are also useful utilities.
  736.  
  737.           Using SETARGV.OBJ to Expand Command Line Wildcards
  738.  
  739. Normally, the startup library routines linked with a C program parse
  740. the command line arguments into words and pass the result to the
  741. "main()" function as the arguments "argc" and "argv[]", where "argc"
  742. is the number of words and "argv[]" is an array of argc char pointers
  743. to '\0' terminated strings containing one argument each.  A useful
  744. alternative is to substitute startup code which will not only parse
  745. the arguments into words, but expand those which represent wildcards
  746. for filenames into a list of matching files.  To do this under release
  747. 4.0 include the file xSETARGV.OBJ in the link step, where 'x' is the
  748. memory model in use, "SSETARGV" for small, "LSETARGV" for large, etc.
  749. For the program "ARGS.C", shown in figure 1, compiled with the default
  750. small memory model, the command to link is:
  751. C News 1-04                 Page 16                  21 Feb 1988
  752.      
  753. ================================================================
  754. Title: Filename Wildcard Expansion in Microsoft C
  755. ================================================================
  756.  
  757.     LINK ARGS+SSETARGV
  758.  
  759. (Using release 5.0, you no longer need to specify the memory model,
  760. but you must specify the "/NOE" link option to avoid an error message
  761. since "setargv" is a duplicate name.  The command to compile and link
  762. would be "CL ARGS.C \BIN\SETARGV.OBJ /link /NOE.)
  763.  
  764. The resulting ARGS.EXE simply writes its arguments to the standard
  765. output file, one per line, surrounded by double quotation marks.  This
  766. enables you to see exactly what is being done with the arguments you
  767. enter by SETARGV.  To get rid of the double quotes around each
  768. argument, compile with the option "/DNOQUOTES".
  769.  
  770. A little experimentation with ARGS will show the following:
  771. (1) Arguments which do not contain wildcard characters are passed as
  772. is to "main()", in the normal way.
  773.  
  774. (2) Wildcard arguments are expanded into the list of files which match
  775. the pattern, each matching file being appearing as a separate
  776. argument. If no files match a pattern the pattern is passed as is to
  777. "main()".
  778.  
  779. (3) If a drive and directory is specified along with filename.ext, and
  780. filename.ext contains a wildcard, each of the resulting actual
  781. filenames will include the drive and directory.  As with DOS,
  782. wildcards are allowed only in the filename and extent, not in the
  783. directory part.
  784.  
  785. (4) If null extents are allowed, and any subdirectory names match the
  786. filename part, the names of these subdirectories are also passed to
  787. "main()".  The program must use other means to distinguish between
  788. directories and files.  The simplest, when you expect a file, is to
  789. try to open it and check the return code.
  790.  
  791. (5) Any string in the command line surrounded by double quotation
  792. marks is passed to "main()" as is.  You can use this to disable
  793. wildcard expansion for a given argument, or to pass strings containing
  794. blanks without splitting them into separate words.  If you mean to
  795. pass "*" as an argument, and you don't want it to be replaced by the
  796. names of all the files in the current directory which have no extents,
  797. include the quote marks in the command line.
  798.  
  799. (6) "main()" cannot distinguish between a list of files actually given
  800. on the command line and a list resulting from matching a wildcard, nor
  801. can it see the original wildcard argument.  If it is necessary to do
  802. that, you must look at the unparsed command line arguments stored in
  803. the program segment prefix.  Since that area is also used as a disk
  804. transfer area, your program should make a copy of the string before
  805. C News 1-04                 Page 17                  21 Feb 1988
  806.      
  807. ================================================================
  808. Title: Filename Wildcard Expansion in Microsoft C
  809. ================================================================
  810.  
  811. doing anything else.
  812.  
  813. (7) Wildcards are not only expanded, the list resulting from each
  814. wildcard is sorted.  Filenames matching a wildcard are passed to
  815. "main()" in alphabetical order.
  816.  
  817. Obviously just linking with SETARGV.OBJ does a lot for you, most of it
  818. useful.  In fact, the simple ARGS program, written just to test this
  819. option, is a nice file listing utility in own right, displaying a
  820. sorted list of files in one or more directories.  For this use, you
  821. probably don't want the double quote marks around each filename, so
  822. try compiling with the "/DNOQUOTES" option.  The final .EXE file might
  823. be named something like "SFILES.EXE" to give a better indication of 
  824. its function.
  825.  
  826.             Expanding Wildcards With DOS Calls In Programs
  827.  
  828. As useful as wildcard expansion in command line arguments can be,
  829. there are times when it is necessary to perform the same function
  830. inside a program.  This can be easily accomplished using a few DOS
  831. calls, which is much easier than you might think.  The source code for
  832. a simple file find utility using this technique is shown in figure 2.
  833. All the required DOS function calls are performed in the functions
  834. "findentr()" and "findnext()" (figure 3) and its subroutines
  835. "get_DTA()" and "set_DTA()" (figure 4).
  836.  
  837. DOS functions are called by executing interrupt 0x21, with the AH
  838. register containing the number of the function to be performed and
  839. other registers used to pass other arguments.  The registers contain
  840. either the arguments for a specific function or the addresses of
  841. blocks of memory to be used by the function.  Filenames are
  842. conveniently passed as ASCII strings terminated by '\0', which is
  843. exactly the way strings are stored in C. You need to know about the
  844. registers and understand the segment:offset addressing scheme used by
  845. the PC, but assembly language is generally not required.
  846.  
  847. In Microsoft C, the functions "intdos()" and "intdosx()" are used. 
  848. The header file "DOS.H" defines the union REGS and structure SREGS
  849. used to hold register values passed to and from the software interrupt
  850. handler. The SREGS structure is used with "intdosx()" to pass values
  851. for the segment registers.  The REGS union is used for the other
  852. registers. When segment registers are not needed "intdos()" is used. 
  853. Main memory addresses must be given by segment and offset.  Microsoft
  854. C programs can use the macros FP_SEG and FP_OFF to extract the segment
  855. and offset components of far pointers.  Other implementations of C
  856. usually provide similar functions, so it should be easy to port the
  857. routines shown here to other versions of C.
  858.  
  859. C News 1-04                 Page 18                  21 Feb 1988
  860.      
  861. ================================================================
  862. Title: Filename Wildcard Expansion in Microsoft C
  863. ================================================================
  864.  
  865. Microsoft C also provides a few other functions for executing low
  866. level functions.  They are not used by the routines shown here, but
  867. may used in other cases.  For DOS functions which take no arguments,
  868. or only arguments in the DX and AL registers, the simpler "bdos()"
  869. function will do.  It has the advantage of taking only integer
  870. arguments and returning the result as an integer return value.  Many
  871. of the low level keyboard and console functions can use this.  On the
  872. other end of the scale, "int86()" and "int86x()" work like "intdos()"
  873. and "intdosx()", except that they accept an interrupt number so any
  874. interrupt can be executed, not just 0x21.
  875.  
  876. The DOS functions used to expand wildcards in file names are 0x4E
  877. (Find Match File) and 0x4F (Find Next File).  The process is started
  878. by calling 0x4E, which finds the first file matching the given name
  879. and initializes a data structure used by 0x4F to find successive
  880. matches. As with many DOS functions, these two indicate failure by
  881. setting the carry flag and placing an error code in the AX register,
  882. both of which are returned to the C program in the REGS union.
  883.  
  884. The data structure initialized by "findentr()" and used by
  885. "findnext()" is located in an area called the disk transfer area
  886. (DTA).  This is not explicitly passed to DOS functions, but is kept
  887. track of by DOS.  When a program starts, the DTA occupies the last
  888. half of the program segment prefix, overlaying the unparsed command
  889. line arguments.  This means that programs which look at the unparsed
  890. command line arguments should make a copy of this area as soon as they
  891. begin, before the DTA is used for anything else.  Programs can get the
  892. current value of the DTA address by executing the DOS function 0x2F
  893. and can change it by function 0x1A. These DOS functions are performed
  894. by "get_DTA()" and "set_DTA()", respectively.
  895.  
  896. The header file "DOSTYPE.H" (figure 5) gives the format of the DTA
  897. used by "findentr()" and "findnext()", as well as defining the bit
  898. values used for file attributes.  In order to find directories,
  899. hidden, and system files you must specify those attributes when
  900. calling "findentr()".  Besides the file name and extent (ready to use
  901. as a C string) and attributes, the DTA contains the date and time the
  902. file was last written in a coded binary form and the size of the file
  903. as a long integer. The declarations in "DOSTYPE.H" include the bit
  904. fields in the date and time stamps, even though they are not needed by
  905. the sample programs shown here.
  906.  
  907. To avoid any conflict in the different uses of the DTA, it is a good
  908. idea for each routine using a DTA to save the current address with
  909. "get_DTA()", set their own using "set_DTA()", and restore the old
  910. address with another call to "set_DTA()" when done.  Both "findentr()"
  911. and "findnext()" take the address of a DTA in the caller's local
  912. storage as an argument and call "get_DTA()" and "set_DTA()" to
  913. C News 1-04                 Page 19                  21 Feb 1988
  914.      
  915. ================================================================
  916. Title: Filename Wildcard Expansion in Microsoft C
  917. ================================================================
  918.  
  919. temporarily set the DTA to that address. They return zero to indicate
  920. that a file was found and 18 to indicate no (or no more) files.
  921. "findentr()" returns two to indicate an invalid pathname.
  922.  
  923. The program FF (figure 2) is a simple file find utility similar to the
  924. Norton Utilities FF.COM.  FF searches an entire disk or the subtree
  925. starting with a specified directory for files matching a filename and
  926. extent which may contain wildcards.  This is useful when you either
  927. want to find all occurrences of a file which exists in many
  928. directories, or if you forget what directory contains a given file. 
  929. The "main()" function simply checks to see that an argument was given
  930. and separates it into a path and filename part.  If no path
  931. (directory) was specified, the root directory on the default drive is
  932. used.  This initial path and filename is then passed to "trav()". The
  933. most interesting function is "trav()" (for traverse).  Traversing a
  934. subtree means to somehow reference or do something at each node.  The
  935. specialized function "trav()" first uses "findentr()" and "findnext()"
  936. to find the matching files in the directory specified and then
  937. finds all the subdirectories by the same method, this time specifying
  938. that files with the DIRECTORY attribute, any file name, and no extent
  939. be returned.  Unless attributes are specified, only normal files which
  940. are not hidden would be found.  It is not possible to exclude regular
  941. files when calling "findentr()", so "trav()" has to check the
  942. DIRECTORY bit in DTA.attr itself.  It would have been useful here to
  943. declare bit fields within the attribute byte, but unfortunately bit
  944. fields cannot be defined within a single byte.  The next best thing is
  945. to use "#define" to give symbolic names to the values of the bits for
  946. each attribute and then use bitwise and operations to test them.
  947.  
  948. For each subdirectory, "trav()" calls itself recursively, specifying
  949. the subdirectory found and the same filename and extent from the
  950. original argument.  It is because of this recursion that each
  951. invocation of "trav()" must have its own DTA and other local
  952. variables.  This is accomplished by simply declaring them with the
  953. default auto storage class within "trav()".
  954.  
  955. Recursion is often illustrated by value returning numerical functions,
  956. such as factorials, but is also useful for subroutines (or void
  957. functions in C).  Actually, the usual numerical examples are not
  958. really very practical.  Mathematicians like to work with recursive
  959. definitions of functions not because that is a necessarily a practical
  960. method of computation, but because the recursive definitions are
  961. sometimes simpler and easier to use in inductive proofs.
  962.  
  963. The example of recursion provided by "trav()" is a more practical one.
  964. Since directories may contain other directories, the natural
  965. definition is recursive, and the traversal implemented by "trav()" is
  966. the most natural way to find all the directories in the tree.  Compare
  967. C News 1-04                 Page 20                  21 Feb 1988
  968.      
  969. ================================================================
  970. Title: Filename Wildcard Expansion in Microsoft C
  971. ================================================================
  972.  
  973. the simplicity of the method used with any nonrecursive implementation
  974. you can devise (and there are many) and you should get an appreciation
  975. for the little used (but sometimes misused) technique of recursion.
  976.  
  977.                             Summary
  978.  
  979. The examples given here are simplified, but are still useful programs.
  980. They illustrate the use of "SETARGV.OBJ" and the functions
  981. "findentr()", "findnext()", "get_DTA()", and "set_DTA()", any or all
  982. of which can be incorporated into your own programs.  Using them, your
  983. programs can expand wildcards without direct reference to the DOS
  984. functions.  More importantly, I hope that you can see from these
  985. examples that it is easy to use DOS functions, even if you do not know
  986. assembly language, and that you will be encouraged to learn about and
  987. use other DOS functions to extend the power of C programs operating in
  988. the DOS environment.
  989.  
  990.  
  991.                             Figure 1 - ARGS.C
  992.  
  993. /* Display command line arguements */
  994. /* Link with SSETARGV.OBJ.         */
  995. #include <stdio.h>
  996. main(argc, argv) int argc; char *argv[];
  997. {
  998. int i;
  999. for (i=1; i<argc; ++i)
  1000.   {
  1001.   #ifdef NOQUOTES
  1002.   puts(argv[i]);
  1003.   #else
  1004.   /*
  1005.      Use of lower level output routines saves space if "printf()"
  1006.      is not needed elsewhere, though "printf()" would be a little
  1007.      less cumbersome at the source level.
  1008.   */
  1009.   putchar('"');
  1010.   fputs(argv[i],stdout);
  1011.   putchar('"');
  1012.   putchar('\n');
  1013.   #endif
  1014.   }
  1015. }
  1016.                              Figure 2 - FF.C
  1017. #include <stdio.h>
  1018. #include <string.h>
  1019. #include "dostype.h"
  1020.  
  1021. C News 1-04                 Page 21                  21 Feb 1988
  1022.      
  1023. ================================================================
  1024. Title: Filename Wildcard Expansion in Microsoft C
  1025. ================================================================
  1026.  
  1027. main(argc,argv) int argc; char *argv[];
  1028. {
  1029. char st_dir[128];
  1030. char *namepart;
  1031. int i, j;
  1032. if (argc<2) exit(1);
  1033. i=strlen(argv[1])-1;
  1034. while (i>=0 && argv[1][i]!='\\' && argv[1][i]!=':') --i;
  1035. if (i>=0)
  1036.   {
  1037.   if (argv[1][i]==':')
  1038.     {
  1039.     st_dir[i+1]='\\';
  1040.     st_dir[i+2]='\0';
  1041.     }
  1042.   else
  1043.     st_dir[i+1]='\0';
  1044.   namepart=argv[1]+i+1;
  1045.   while (i>=0)
  1046.     {
  1047.     st_dir[i]=argv[1][i];
  1048.     --i;
  1049.     }
  1050.   }
  1051. else
  1052.   {
  1053.   st_dir[0]='\\';
  1054.   st_dir[1]='\0';
  1055.   namepart=argv[1];
  1056.   }
  1057.  
  1058. trav(st_dir,namepart);
  1059. }
  1060.  
  1061. trav(st_dir,filename_ext)
  1062. char st_dir[];
  1063. char filename_ext[];
  1064. {
  1065. char matchname[128];
  1066. struct DTA_STRUCT DTA;
  1067. unsigned char end_byte;
  1068.  
  1069. /* Show matching files in this directory */
  1070. strcpy(matchname,st_dir);
  1071. strcat(matchname,filename_ext);
  1072. if (findentr(&DTA,matchname,0)==0)
  1073.   do
  1074.     if (!(DTA.attr & DIRECTORY))
  1075. C News 1-04                 Page 22                  21 Feb 1988
  1076.      
  1077. ================================================================
  1078. Title: Filename Wildcard Expansion in Microsoft C
  1079. ================================================================
  1080.  
  1081.       {
  1082.       fputs(st_dir,stdout);
  1083.       puts(DTA.name);
  1084.       }
  1085.   while (findnext(&DTA)==0);
  1086.  
  1087. /* Recursively search subdirectories */
  1088. end_byte=strlen(st_dir);
  1089. matchname[end_byte]='*';
  1090. matchname[end_byte+1]='\0';
  1091. if (findentr(&DTA,matchname,DIRECTORY)==0)
  1092.   do
  1093.     if ((DTA.attr & DIRECTORY) && (DTA.name[0]!='.'))
  1094.       {
  1095.       strcpy(matchname+end_byte,DTA.name);
  1096.       strcat(matchname,"\\");
  1097.       trav(matchname,filename_ext);
  1098.       }
  1099.   while (findnext(&DTA)==0);
  1100. }
  1101.                           Figure 3 - FINDENTR.C
  1102. #include <dos.h>
  1103. #include "dostype.h"
  1104.  
  1105. findentr(DTA, search_name, s_attr)
  1106. struct DTA_STRUCT *DTA; /* NULL to use current DTA */
  1107. char *search_name;
  1108. int s_attr; /* permitted attributes (use for H,S,D) */
  1109. {
  1110. char far *far_sn=search_name;
  1111. /* convert DTA to far rather than place burden on caller */
  1112. /* (only needed by small or medium memory models)        */
  1113. struct DTA_STRUCT far *far_DTA=DTA;
  1114. union REGS inregs;
  1115. struct SREGS segregs;
  1116. unsigned save_DTA_SEG;
  1117. unsigned save_DTA_OFF;
  1118.  
  1119. if (DTA)
  1120.   {
  1121.   /* save current DTA address */
  1122.   get_DTA(&save_DTA_SEG,&save_DTA_OFF);
  1123.   /* set DTA address to argument structure */
  1124.   set_DTA(FP_SEG(far_DTA),FP_OFF(far_DTA));
  1125.   }
  1126.  
  1127. /* Find first match file */
  1128. inregs.h.ah=0x4e;
  1129. C News 1-04                 Page 23                  21 Feb 1988
  1130.      
  1131. ================================================================
  1132. Title: Filename Wildcard Expansion in Microsoft C
  1133. ================================================================
  1134.  
  1135. inregs.x.cx=s_attr;
  1136. segregs.ds=FP_SEG(far_sn);
  1137. inregs.x.dx=FP_OFF(far_sn);
  1138. intdosx(&inregs,&inregs,&segregs);
  1139.  
  1140. if (DTA)
  1141.   /* restore DTA address */
  1142.   set_DTA(save_DTA_SEG,save_DTA_OFF);
  1143.  
  1144. /* return result */
  1145. if (inregs.x.cflag) return (inregs.x.ax);
  1146. else return 0;
  1147. }
  1148.  
  1149. findnext(DTA)
  1150. struct DTA_STRUCT *DTA; /* NULL for current DTA */
  1151. {
  1152. struct DTA_STRUCT far *far_DTA=DTA;
  1153. union REGS inregs;
  1154. struct SREGS segregs;
  1155. unsigned save_DTA_SEG;
  1156. unsigned save_DTA_OFF;
  1157.  
  1158. if (DTA)
  1159.   {
  1160.   /* save current DTA address */
  1161.   get_DTA(&save_DTA_SEG,&save_DTA_OFF);
  1162.   /* set DTA address to argument structure */
  1163.   set_DTA(FP_SEG(far_DTA),FP_OFF(far_DTA));
  1164.   }
  1165.  
  1166. /* Find next entry */
  1167. inregs.h.ah=0x4f;
  1168. intdos(&inregs,&inregs);
  1169.  
  1170. if (DTA)
  1171.   /* restore DTA address */
  1172.   set_DTA(save_DTA_SEG,save_DTA_OFF);
  1173.  
  1174. /*  return  result  */
  1175. if  (inregs.x.cflag)  return (inregs.x.ax);
  1176. else return 0;
  1177. }
  1178.                             Figure 4 - DTA.C
  1179.  
  1180. #include <dos.h>
  1181. /* Set DTA address */
  1182. set_DTA(seg,off)
  1183. C News 1-04                 Page 24                  21 Feb 1988
  1184.      
  1185. ================================================================
  1186. Title: Filename Wildcard Expansion in Microsoft C
  1187. ================================================================
  1188.  
  1189. unsigned seg, off;
  1190. {
  1191. union REGS inregs;
  1192. struct SREGS segregs;
  1193. inregs.h.ah=0x1a;
  1194. segregs.ds=seg;
  1195. inregs.x.dx=off;
  1196. intdosx(&inregs,&inregs,&segregs);
  1197. }
  1198.  
  1199. /* Get current DTA address */
  1200. get_DTA(seg,off)
  1201. unsigned *seg, *off;
  1202. {
  1203. union REGS inregs;
  1204. struct SREGS segregs;
  1205. inregs.h.ah=0x2f;
  1206. intdosx(&inregs,&inregs,&segregs);
  1207. *seg=segregs.es;
  1208. *off=inregs.x.bx;
  1209. }
  1210.                           Figure 5 - DOSTYPE.H
  1211.  
  1212. /* FCB_DATE:                                                         
  1213. */
  1214. /* Date/time fields of FCB (also DTA_STRUCT, defined below)          
  1215. */
  1216.  
  1217. struct FCB_DATE
  1218.   {
  1219.   struct
  1220.     {
  1221.     unsigned seconds:5;
  1222.     unsigned minutes:6;
  1223.     unsigned hours:5;
  1224.     } time;
  1225.   struct
  1226.     {
  1227.     unsigned day:5;
  1228.     unsigned month:4;
  1229.     unsigned year:7; /* 1980=0 */
  1230.     } date;
  1231.   };
  1232.  
  1233. /* DTA.STRUCT:                                                       
  1234. */
  1235. /* Data block returned by DOS functions 0x4E and 0x4F, which find    
  1236. */
  1237. C News 1-04                 Page 25                  21 Feb 1988
  1238.      
  1239. ================================================================
  1240. Title: Filename Wildcard Expansion in Microsoft C
  1241. ================================================================
  1242.  
  1243. /* files and directories matching a pathname, with wildcards.        
  1244. */
  1245.  
  1246. #define ARCHIVE 0x20
  1247. #define DIRECTORY 0x10
  1248. #define SYSTEM 0x04
  1249. #define HIDDEN 0x02
  1250. #define READONLY 0x01
  1251.  
  1252. struct DTA_STRUCT
  1253.   {
  1254.   char reserved[21];
  1255.   char attr;
  1256.   union
  1257.     {
  1258.     struct FCB_DATE field;
  1259.     unsigned long date_time; /* For comparing the combination */
  1260.     } timestamp;
  1261.   unsigned long size;
  1262.   char name[13];
  1263.   };
  1264.  
  1265. C News 1-04                 Page 26                  21 Feb 1988
  1266.      
  1267. ================================================================
  1268. /Usr/Bin  by Marshall Presnell
  1269. ================================================================
  1270.      
  1271.   
  1272.                  The Great Compiler War Myth 
  1273.    
  1274.      If you  have ever read the C Echo Conference on FidoNet,
  1275. I'm sure that  you've witnessed  the advent  of "Compiler Wars". 
  1276. Not that  it's a  new topic,  I'm sure that people have been 
  1277. arguing the merits of their personal favorite compiler since 
  1278. the second  compiler was  written. It's  not the  purpose of 
  1279. this author or C News to say "This is the best compiler". 
  1280. There are  over 30  (and that's  a LOW  estimate)  currently 
  1281. available C  compilers for  the PC.  How does  one go  about 
  1282. determining which  is "best".  It simply  can't be done. One 
  1283. compiler may  excel in  code optimization but have a limited 
  1284. library, another  may have  a robust library but be terrible 
  1285. as far  as compiler features, yet another will have features 
  1286. out the  wazoo, but produce poor code. It goes on to include 
  1287. ANSI compatibility,  preprocessor capabilities,  unused code 
  1288. detection and  elimination, diagnostic  messages, clean user 
  1289. interfaces,    pointer    optimization,    register    usage 
  1290. optimization, etc, etc, ad nauseam. 
  1291.  
  1292.               "But which compiler is the best?" 
  1293.    
  1294. All of  them are,  and none of them are. If they get the job 
  1295. done efficiently for your purposes, it's a good compiler. If 
  1296. they fall  down on your job, it's not a good compiler. Since 
  1297. there  is  no  way  to  adequately  evaluate  the  different 
  1298. compilers in  such a  manner that  everyone agrees with, the 
  1299. question is objectively irresolvable. 
  1300.  
  1301. Oddly enough,  the question  usually  arises  with  specific 
  1302. reference  to  Borland's  Turbo  C,  Microsoft  C  5.0,  and 
  1303. Microsoft Quick C. Well.... ALL of the above packages are in 
  1304. a class  that I  would consider "excellent". All have robust 
  1305. libraries,  support   graphics,  compile  quickly,  generate 
  1306. decent  code.   They  all   are  good  packages  to  develop 
  1307. applications under.  Turbo C  and Quick  C are WONDERFUL for 
  1308. the novice  programmer who  wants to  see what C is, and get 
  1309. some experience  with it.  Basically, I'll take all three if 
  1310. given a  choice. All  have disadvantages,  the  most  common 
  1311. being that  all of them have bugs. I personally prefer Turbo 
  1312. C's graphics  and use  it for  any graphic  presentation  of 
  1313. data, but  for fast code and speed I use Microsoft C 5. It's 
  1314. ALL a matter of personal preference. 
  1315.  
  1316. The point is simply, there ain't no such thing as the best C 
  1317. compiler. There's  no use  even trying  to find it. Use what 
  1318. you have  or what  you buy to it's fullest extent and it's a 
  1319. C News 1-04                 Page 27                  21 Feb 1988
  1320.      
  1321. ================================================================
  1322. /Usr/Bin  by Marshall Presnell
  1323. ================================================================
  1324.  
  1325. good deal (and you may learn something before it's done!). 
  1326. If you  have any topic that you would like to see covered in 
  1327. the /usr/bin,  please feel  free to  drop me a note on the C 
  1328. BBS or via FidoNet. I'm at 109/639.106. 
  1329.  
  1330.         Next issue: How to communicate with a FOSSIL 
  1331.  
  1332.   C News 1-04                 Page 28                  21 Feb 1988
  1333.      
  1334. ================================================================
  1335. ARTICLE SUBMISSION STANDARDS AND ADDRESSES
  1336. ================================================================
  1337.  
  1338.      As I have repeatedly stated in this newsletter and previous
  1339. issues, I would like to see user-submitted articles, reviews or
  1340. questions.  Listed below are the standards that should be
  1341. followed to make my job easier as an editor.
  1342.  
  1343.  
  1344.      - Articles should be submitted in a ASCII non-formatted
  1345.        file.  
  1346.  
  1347.      - If the article include code fragments as examples. Then
  1348.        you can include the entire source file if you like for 
  1349.        inclusion with the newsletter.
  1350.  
  1351.      - Book or magazine reviews should follow the same format,
  1352.        that is outlined in this issue.  The publisher, author,
  1353.        title, and ISBN number are a must.  
  1354.  
  1355.      - Compiler/and or product reviews, should include the
  1356.        version number and manufacture.  If possible, reviews
  1357.        should include a sample program with benchmarks.
  1358.  
  1359.     
  1360.      If you have any questions you can contact me at the
  1361. address's included on the next page.
  1362.  
  1363. C News 1-04                  Page 29                 21 Feb 1988
  1364.  
  1365. ================================================================
  1366. ADDRESSES
  1367. ================================================================
  1368.  
  1369. The C BBS is located at:
  1370.  
  1371.      C BBS
  1372.      % BCL Limited
  1373.      P.O. Box 9162
  1374.      McLean VA, 22102
  1375.  
  1376.  
  1377.      or you can send netmail to:
  1378.  
  1379.  
  1380.      1:109/713  < The phone number in the current nodelist is
  1381.                   inaccurate.  At this time it is not known
  1382.                   when it will be corrected. >
  1383.  
  1384.  
  1385.  
  1386.  
  1387.       C News 1-04                 Page 30                  21 Feb 1988
  1388.      
  1389. ================================================================
  1390. USER RESPONSE FORM:
  1391. ================================================================
  1392.  
  1393. This form will be included as a regular feature in all future
  1394. issues of C NEWS.
  1395.  
  1396.  
  1397.  
  1398.  What did you think of the content of this Issue?  _____________
  1399.      
  1400.  _______________________________________________________________
  1401.  
  1402.  
  1403.  What improvements can you think of that would make C News a
  1404.  better tool for the C Community?
  1405.  
  1406.  _______________________________________________________________
  1407.  
  1408.  _______________________________________________________________
  1409.  
  1410.  
  1411.  What is your favorite section or sections?  ___________________
  1412.  
  1413.  _______________________________________________________________
  1414.  
  1415.  
  1416.  What don't you like about C News?  ____________________________
  1417.  
  1418.  _______________________________________________________________
  1419.  
  1420.  
  1421.  Additional Comments:  _________________________________________
  1422.  
  1423.  _______________________________________________________________
  1424.  
  1425.  _______________________________________________________________
  1426.  
  1427.  _______________________________________________________________
  1428.  
  1429.  C News 1-04                 Page 31                  21 Feb 1988
  1430.      
  1431.  ================================================================
  1432.                               INDEX
  1433.  ================================================================
  1434.  
  1435.  Subject:                                          Issue:
  1436.  
  1437.  Articles:
  1438.  
  1439.  Filename Wildcard Expansion in MSC                 4
  1440.  TurboC and Interrupts: A few Questions             2
  1441.      
  1442.  
  1443.  Book Reviews:
  1444.  
  1445.  C Database Development                             1
  1446.  C Programming Guide                                1
  1447.  C Programming Language                             1
  1448.  C Programmer's Guide to Serial Communications      3
  1449.  C Programmer's Library                             1
  1450.  C Primer Plus                                      1
  1451.  C the Complete Reference                           2
  1452.  Crafting C Tools for the IBM PC                    2
  1453.  Learning to Program in C                           1
  1454.  Microsoft C Programming on the IBM PC              1
  1455.  MS-DOS Developer's Guide                           4
  1456.  Programming in Windows                             3
  1457.  Reliable Data Structures in C                      1
  1458.  TurboC Programmer's Reference Book                 2
  1459.  
  1460.  
  1461.  Compilers: 
  1462.  
  1463.  QuickC                                             1 
  1464.  
  1465.      
  1466.  Software Reviews: 
  1467.   
  1468.  Bplus11.arc                                        3
  1469.  C_Dates.arc                                        4
  1470.  Cdate.arc                                          4
  1471.  Casm.arc                                           3
  1472.  C-subr.arc                                         4
  1473.  Docu.arc                                           3
  1474.  Jcl-src.arc                                        4
  1475.  Mscpopup.arc                                       3
  1476.  Ndmake41.arc                                       4
  1477.  Nuc-subr.arc                                       3
  1478.  Shift_c.arc                                        4
  1479.  Sysact11.arc                                       4
  1480.  Tp_to_qc.arc                                       3
  1481.  Xenixarc.arc                                       4
  1482.  
  1483.  
  1484.